package com.olddriver.crm.service.impl;

import com.olddriver.crm.domain.ClientLose;
import com.olddriver.crm.mapper.ClientLoseMapper;
import com.olddriver.crm.page.PageResult;
import com.olddriver.crm.query.ClientLoseQueryObject;
import com.olddriver.crm.service.IClientLoseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;

@Service
public class ClientLoseServiceImpl implements IClientLoseService {

    @Autowired
    private ClientLoseMapper clientLoseMapper;

    public int save(ClientLose clientLose){
        return clientLoseMapper.save(clientLose);
    }

    public PageResult query(ClientLoseQueryObject qo) {
        int total = clientLoseMapper.queryTotal(qo);
        if (total == 0) {
            return new PageResult(total, Collections.emptyList());
        }
        return new PageResult(total, clientLoseMapper.queryRows(qo));
    }
}
